//引用Vue，Vue-router
import Vue from "vue";

import Router from "vue-router";

Vue.use(Router);

//引入.vue文件作为路由
//所有新建的文件必须要到这里引入
import coming_play from "../views/coming_play.vue";
import home from "../views/home.vue";
import details from "../views/details.vue";
import now_play from "../views/now_play.vue";
import film_info from "../views/film_info.vue";
import adress from "../views/adress.vue";

//配置组件路径的注册
//const表示不可修改的常量

const routes = [{
		path: '/',
		redirect: 'home'
	}, //重定向默认页面

	{
		//路由的名称
		name: "film_info",
		//路由的路劲
		path: "/film_info",
		//vue文件作为模板引入
		component: film_info,

	},
	{
		//路由的名称
		name: "adress",
		//路由的路劲
		path: "/adress",
		//vue文件作为模板引入
		component: adress,

	},
	{
		//路由的名称
		name: "home",
		//路由的路劲
		path: "/home",
		//vue文件作为模板引入
		component: home,

	},
	{
		//路由的名称
		name: "details",
		//路由的路劲
		path: "/details",
		//vue文件作为模板引入
		component: details,
		children: [{
				path: "/",
				redirect: 'now_play'
			},
			{
				//路由的名称
				name: "now_play",
				//路由的路劲
				path: "now_play",
				//vue文件作为模板引入
				component: now_play,
			},
			{
				//路由的名称
				name: "coming_play",
				//路由的路劲
				path: "coming_play",
				//vue文件作为模板引入
				component: coming_play,
			},
		]
	},
]

console.log(routes)
//创建vue-router 的实例
const router = new Router({
	//注意事项：Router对象的路由配置，属性名为routes,切记不要改动
	routes: routes
});
//输出给其他文件使用router对象
export default router;